<?php
Yii::app()->clientScript->registerScript('sel_status', "$('#selStatus').change(function(){ $.fn.yiiGridView.update('niniosCartaNutricional-grid',{data: $(this).serialize()}); return false;});");
$this->beginWidget('zii.widgets.CPortlet', array(
    'title' => Yii::t('AweCrud.app', 'List') . ' ' . Ninios::label(2),
));
?>
<br>

<?php
if (Yii::app()->user->checkAccess("admin")) {
    $dataProvider = $submodel->sinFechaSalida()->search();
    $data = array('empty' => '- Seleccione institución -') + CHtml::listData(Institucion::model()->findAll(), 'id', Institucion::model()->representingColumn());
    $select = key($data);
    echo CHtml::dropDownList('dropDownStatus', $select, $data, array('style' => 'margin-botton:10px',
        'id' => 'selStatus')
    );
} else if (Yii::app()->user->checkAccess("institucion")) {
    $dataProvider = $submodel->de_institucion_id()->sinFechaSalida()->search();
}
$this->widget('ext.selgridview.BootSelGridView', array(
    'id' => 'niniosCartaNutricional-grid',
    'type' => 'striped bordered hover advance',
    'template' => '{items}{summary}{pager}',
    'selectableRows' => 2,
    'dataProvider' => $dataProvider,
    'filter' => $submodel,
    'columns' => array(
        array(
            'name' => 'id_cartaNinios',
            'id' => 'check_Ninios',
            'class' => 'CCheckBoxColumn',
            'value' => '$data->id',
        ),
        array(
            'name' => 'nombres',
            'header' => 'Nombre',
            'value' => '$data->nombre_completo',
        ),
//        array(
//            'name' => 'edad',
//            'header' => 'Edad',
//            'value' => '$data->edad',
//        ),
    ),
));
?>
<?php $this->endWidget(); ?>

